<script>
	export default {
		onLaunch: async function(options) {
			console.log('App Launch')
			// uni.$store.dispatch('user/getinfo')
			if (options.query && options.query.qrCode) {
				console.log('App Launch', options.query.qrCode)
				this.globalData.qrCode = options.query.qrCode
			}
			// #ifdef APP-PLUS
			// {cur_v,pass_v,reqUrl,is_force,apk_name,apk_desc}cur_v,pass_v,reqUrl,is_force,apk_name,apk_desc
			let {
				cur_v,
				pass_v,
				reqUrl,
				is_force,
				apk_name,
				apk_desc
			} = await this.$store.dispatch('version/updateApp');
			// console.log("cur_v,pass_v,reqUrl,is_force,apk_name,apk_desc===",cur_v,pass_v,reqUrl,is_force,apk_name,apk_desc)
			// cur_v后端返，pass_v本地配置
			if (cur_v > pass_v) {

				if (is_force == 1) {
					this.$store.commit('version/downloadAPP', reqUrl)
				} else {
					uni.showModal({
						title: apk_name,
						content: apk_desc || '检测到有数据包更新，是否进行更新？', //可后台配置更新文字返回显示：data.msg
						confirmText: '立即进行',
						confirmColor: '#333333',
						cancelColor: '#999999',
						success: (res) => {
							if (res.confirm) {
								this.$store.commit('version/downloadAPP', reqUrl)
							} else if (res.cancel) {}
						}
					});
				}
			}
			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang='scss'>
	@import "style/common.css";
	/* @import "style/icon.css"; */

	.input-placeholder,
	.placeholder {
		color: $placeholder-color !important;
	}
</style>